<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script th:src="@{/}+'js/day.js'"></script>
<link rel="stylesheet" href="layuiadmin/plugins/dtree/dtree/dtree.css">
<link rel="stylesheet" href="layuiadmin/plugins/dtree/dtree/font/dtreefont.css">
    <link rel="stylesheet" th:href="@{/}+'js/jquery.mloading/jquery.mloading.css'" media="all">
	<script th:src="@{/}+'js/jquery.mloading/jquery.mloading.js'"></script>
</head>
<body>
<div class="layui-fluid" id="app">
  <div class="layui-card">  
    <div class="layui-card-body">
      <div class="layui-row">
    <div class="layui-row layui-col-space5">
		    <div class="layui-row">
		    <div class="layui-inline">
		         <input type="text" id="name" placeholder="用户名称/电话号码" autocomplete="off" class="layui-input">
		    </div>
		    <div class="layui-input-inline">
      			<ul id="nodeOrgId" name="nodeOrgId" class="dtree" data-id="0" ></ul>
    		</div>
		    <div class="layui-btn-group">
			    <button type="button" class="layui-btn layui-btn-primary" data-type="query">查询</button>
		  	</div>
		  	</div>
		 	  <div class="layui-row">
		 	  <table id="user-table" lay-filter="user-table"></table>
		      </div>
      		</div>
  </div>
    </div>
  </div>
</div>

<script th:inline="javascript">
/*<![CDATA[*/
var paperId=/*[[${paperId}]]*/
/*]]>*/
</script>
<script th:inline="none">

layui.extend({ 
	dtree: '{/}layuiadmin/plugins/dtree/dtree/dtree'
});
layui.use(['table','form','element','dtree'], function(){
  var form = layui.form
  ,element = layui.element
  ,dtree = layui.dtree
  ,table = layui.table;
  var orgTree = dtree.renderSelect({
	  elem: "#nodeOrgId",
	  url: "org/getDTree",
	  checkbar: false ,
	  selectTips: "选择部门",
	  done:function(a,b,c){

	  }
  });
  table.render({
	    elem: '#user-table'
	    ,url: 'user/getPageList' 
	    ,where:{notPaperId: paperId}
	    ,cols: [[
	      {type: 'checkbox'}
	      ,{field: 'id', width: 150, title: 'ID',hide:true}
	      ,{field: 'name', width: 140, title: "姓名"}
	      ,{field: 'jobNumber', title: "工号",width:130}
	      ,{field: 'nodeOrgName', title: "参赛队",width:130}
	    ]]
	    ,page: true
	    ,limit: 15
	    ,height: 690
	    ,text: "数据错误"
	    ,done:function(){
	    
	    }
	  });
    table.on('row(user-table)', function(obj){
  		clickLayTableRow(table,form,'user-table',obj);
    });
	window.getIds = function(){
		var checkStatus = table.checkStatus('user-table'); 
		let data = checkStatus.data;
		let ids = [];
		for(var i=0;i<data.length;i++){
			ids.push(data[i].id);
			
		}
		return ids;
	}
	window.refreshGrid = function(){
		table.reload("user-table");
	}
  var action = {
	query: function(){
		var whr = {name:$('#name').val(),notPaperId:paperId};	 
		whr.orgId = $(":input[name=nodeOrgId_select_nodeId]").val();
		table.reload("user-table",{
			where:whr,page:{curr:1}
		}) 
	}
  };
  
  $('.layui-btn').each(function(i,obj){
	  $(this).on('click', function(){
		   var type = $(this).data('type');
		   action[type].call(this);
	  })
  });
});
var closeMLodding = function(){
	  $("#app").mLoading("hide");
  }
var openMLodding = function(){
	 $("#app").mLoading({text:"正在保存数据，请稍候"});
  }
</script>
</body>